def create_state(max_items=4):
    return {"items": [], "max_items": max_items, "next_id": 1}

def add_item(state, name, price, production_date):
    if len(state["items"]) >= state["max_items"]:
        return False, "Maximum number of items reached."
    state["items"].append({
        "id": state["next_id"],
        "name": name,
        "price": float(price),
        "production_date": production_date,
    })
    state["next_id"] += 1
    return True, "Item added successfully."

def delete_item(state, id_):
    for i, item in enumerate(state["items"]):
        if item["id"] == id_:
            del state["items"][i]
            return True, "Item deleted successfully."
    return False, "Item not found."

def list_items(state):
    return state["items"]

def clear(state):
    state["items"] = []
    state["next_id"] = 1
    return True

def load_items_into_state(state, items):
    clear(state)
    for item in items:
        add_item(state, item["name"], item["price"], item["production_date"])
    return True
